<template>
	<!-- 就医评价,查看当前医院所有医生的评价 -->
	<view>
		<UserInfoCardVue></UserInfoCardVue>
		<TabCenterVue :current="current" :list="listBar" @click="changeTab"></TabCenterVue>
		<view class=" pad-16r">
			<view v-for="item in listDoctor" class="item">
				<view class="mar-10-0 border-bottom" @click="toPageDoctor(item)">
					<view class="flex-start center">
						<image class="img-pinjia" v-if="item.doctorHead" :src="hostApi+item.doctorHead"></image>
						<image class="img-pinjia" v-else src="/static/images/光华/刘洋.png"></image>
						<view class="mar-0-5 over">
							<view class="between center">
								<view class="font-size-20">{{item.doctorName}}</view>
								<view class="flex-start">
									<u-rate v-if="item.fraction" :current="item.fraction"></u-rate>
									<view v-else @click.stop="toPage(item)">去评价
									</view>
									<!-- <view class="mar-0-5">{{item.fraction}}</view> -->
								</view>
							</view>
							<view class="color-gray">
								<view>{{item.jobTitle}}</view>
								<view>{{item.createTime}}</view>
							</view>
						</view>
					</view>
					<view>
						<u-parse class="content" :html="item.describe"></u-parse>
					</view>
				</view>
			</view>

			<view v-if="listDoctor.length==0" class="text-center">暂无需评价</view>
		</view>
	</view>
</template>

<script>
	import {
		doctorEvaluatePatient,

	} from '../../api/doctorEvaluate'
	import {
		mapGetters
	} from 'vuex'
	import UserInfoCardVue from '../../components/UserInfo/UserInfoCard.vue'
	import TabCenterVue from '../../components/Tabs/TabCenter.vue'
	export default {
		components: {
			UserInfoCardVue,
			TabCenterVue
		},
		data() {
			return {
				listEvaluate: [],
				count: 0,
				listDoctor: [],
				listBar: [{
					id: 1,
					name: '医生'
				}, {
					id: 2,
					name: "护士"
				}],
				current: 0,
				listNurse: [{

				}]
			}
		},
		computed: {
			...mapGetters(['hostApi', "userInfo"])
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				if (!this.userInfo) {
					this.$u.toast('请选择就诊卡')
					return;
				}
				this.listDoctor = []
				doctorEvaluatePatient({
					patId: this.userInfo.patId,
					status: 1,
					jobType: this.current == 0 ? 1 : 2,
					orderBy: "fraction desc,create_time desc"
				}).then(res => {
					this.listDoctor = res;
				})
			},
			toPage(item) {
				if (this.current == 0) {
					uni.navigateTo({
						url: '/pages/Introduce/MedicalEvaluationTemplate?item=' + JSON.stringify(item)
					})
				} else {
					uni.navigateTo({
						url: '/pages/Introduce/MedicalEvaluationNursingTemplate?item=' + JSON.stringify(item)
					})
				}

			},
			toPageDoctor(item) {
				// uni.setStorageSync("doctorCode", item.doctorCode)
				uni.setStorageSync("doctorCurrent", 1)
				if (this.current == 0) {
					uni.navigateTo({
						url: '/pages/Introduce/doctor?code=' + item.doctorCode
					})
				} else {
					uni.navigateTo({
						url: '/pages/Home/ServeComposite/NursingInfo?code=' + item.doctorCode
					})
				}

			},
			changeTab(e) {
				this.current = e
				this.init()
			}
		}
	}
</script>

<style scoped>
	.img-pinjia {
		width: 50px;
		height: 50px;
		border-radius: 30px;
	}

	.content {
		color: rgb(110, 114, 120);
	}

	.item {
		padding: 10px;
		box-shadow: 0 5px 1000px 1rpx #e0e2e7;
		background-color: white;
		margin: 16rpx 0;
		border-radius: 10px;
	}
</style>